package weixin02.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/*
 * 返回json数据
 * */

@NoArgsConstructor
@AllArgsConstructor
public class R {
    private Object data; //返回数据
    private String code; //状态码
    private String msg;  //描述信息


    private Long count; //总数据

    private  ResultCode resultCode;

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public R(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public R(Object data, ResultCode resultCode) {
        this.data = data;
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();

    }

    public R(Object data, ResultCode resultCode, Long count) {
        this.data = data;
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.count = count;

    }

    public R(ResultCode resultCode) {
        this.code = resultCode.getCode();
    }

}
